package bai3;

import java.util.Scanner;

public class Profile {
	private String name;
	private String dateOfBirth;
	private String address;
	private int phone;
	private String email;
	public Profile(){
		
	}
	public Profile(String name, String dateOfBirth, String address, int phone,
			String email) {
		super();
		this.name = name;
		this.dateOfBirth = dateOfBirth;
		this.address = address;
		this.phone = phone;
		this.email = email;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDateOfBirth() {
		return dateOfBirth;
	}
	public void setDateOfBirth(String dateOfBirth) {
		this.dateOfBirth = dateOfBirth;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public int getPhone() {
		return phone;
	}
	public void setPhone(int phone) {
		this.phone = phone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public Profile inputProfile(){
		Scanner ip=new Scanner(System.in);
		System.out.println("======Them moi Profile======");
		System.out.println("Nhap name:");
		String name=ip.nextLine();
		while(name.trim().equalsIgnoreCase("")){
			System.out.println("Chua nhap gia tri");
			name=ip.nextLine();
		}
		System.out.println("Nhap ngay sinh:");
		String dateOfBirth=ip.nextLine();
		while(dateOfBirth.trim().equalsIgnoreCase("")){
			System.out.println("Chua nhap gia tri");
			dateOfBirth=ip.nextLine();
		}
		if(!App.isValidDate(dateOfBirth)){
			System.out.println("Nhap khong dung dinh dang");
			dateOfBirth=ip.nextLine();
		}
		System.out.println("Nhap dia chi");
		String address=ip.nextLine();
		while(address.trim().equalsIgnoreCase("")){
			System.out.println("Chua nhap gia tri");
			address=ip.nextLine();
		}
		System.out.println("Nhap so dien thoai");
		int phone=Integer.parseInt(ip.nextLine());
		System.out.println("Nhap email");
		String email=ip.nextLine();
		while(email.trim().equalsIgnoreCase("")){
			System.out.println("Chua nhap gia tri");
			email=ip.nextLine();
		}
		Profile pf=new Profile(name,dateOfBirth,address,phone,email);
		return pf;
		
	}
	public void display(Profile pf){
		System.out.println("Name: "+pf.name  );
		System.out.println("Ngay sinh: "+pf.dateOfBirth);
		System.out.println("Dia chi: "+pf.address);
		System.out.println("So dien thoai: " +pf.phone);
		System.out.println("Email: "+pf.email);
	}

}
